




package cn.edu.scau.cmi.houzhicong.client;
import cn.edu.scau.cmi.houzhicong.adapterPattern.adapter.ObjectAdapter;
import cn.edu.scau.cmi.houzhicong.adapterPattern.domain.AC220;
import cn.edu.scau.cmi.houzhicong.adapterPattern.domain.DC5;
import cn.edu.scau.cmi.houzhicong.interProgramming.domain.A;
import cn.edu.scau.cmi.houzhicong.interProgramming.domain.B;
import cn.edu.scau.cmi.houzhicong.interProgramming.domain.C;
import cn.edu.scau.cmi.houzhicong.singletonPattern.domain.SingleChairMan;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class ObjectAdapterClient extends Application {


    @Override
    public void start(Stage primaryStage) {
        Text text = new Text();
        try {

            Pane vBox = new VBox();
            Button addButton = new Button("运行");
            addButton.setOnAction(e->{
                DC5 dc5 = new ObjectAdapter(new AC220());
                text.setText("使用对象适配器，将220V电压转为："+dc5.output5V()+"V。");
            });

            addButton.setPrefSize(100,30);
            vBox.getChildren().add(addButton);
            vBox.getChildren().add(text);

            Scene scene = new Scene(vBox,250,100);
            primaryStage.setScene(scene);
            primaryStage.show();

        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}
